<template>
	<view>
		<view class="box1">
			<cover-image src="../../static/logo.png" class="tx"></cover-image>
			<text class="name">{{user.username}}</text>
		</view>
		<view class="box2">
			<uni-list>
				<uni-list-item :title="'余额：'+ user.jine" :to="`./`" @click="goPath('yue')"></uni-list-item>
				<uni-list-item title="任务中心" :to="`./`" @click="goPath('rwcenter')"></uni-list-item>
				<uni-list-item title="余额充值" :to="`./`" @click="goPath('cz')"></uni-list-item>
				<uni-list-item title="佣金提现" :to="`./`" @click="goPath('tixian')"></uni-list-item>
				<uni-list-item title="实名认证" :to="`./`" @click="goPath('shiming')"></uni-list-item>
			</uni-list>
		</view>
	</view>
</template>

<script>
import { baseDefaultUrl } from '../../config/config'
	export default {
		onShow() {
			this.getMe()
		},
		data() {
			return {
				user:''
			}
		},
		methods: {
			goPath(e) {
				uni.navigateTo({
					url: '/pages/' + e + '/' + e
				})
			},
			getMe(){
				uni.request({
					url: baseDefaultUrl + "/inter/user/get",
					method: 'GET',
					data: {
						"username": uni.getStorageSync('phone'),
					},
					header: {
						"Authorization": uni.getStorageSync('token')
					},
					success: (res) => {
						if (res.data.code != 0) {
							this.user = res.data.data
							console.log(this.user);
						} else {
							alert(res.data.message)
						}
					}
				})
			}
		}
	}
</script>

<style>
	page {
		background: #f5f5f5;
	}

	.box1 {
		width: 100%;
		height: 180rpx;
		background: #874bff;
		padding: 50rpx 0;
		box-sizing: border-box;
		display: flex;
	}

	.tx {
		width: 80rpx;
		height: 80rpx;
		margin: 0 30rpx;
	}

	.name {
		font-size: 40rpx;
		color: #fff;
		line-height: 80rpx;
	}

	.box2 {
		padding: 30rpx;
	}
</style>